package com.ljx.List;

/**
 * @author 李加喜
 * @Package com.ljx.List
 * @date 2021-11-30 13:45
 */
public class YuanDiQuChu {
    public static void main(String[] args) {

    }
    public int removeElement(int[] nums, int val) {
        int n=nums.length;
        if (n==0){
            return 0;
        }
        int slow=0,fast=0;
        while (fast<n){
            if (nums[fast]!=val){
                nums[slow]=nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;
    }
}
